package com.company;

import com.sun.corba.se.spi.orbutil.threadpool.Work;
class Worker {
    public String name;
    private int age;
    public Worker(String name) {
        this.name = name;
    }
    public Worker(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public String toString() {
        return "大家好！我是新来的员工，我叫"+name+"，今年"+age+"岁。";
    }
}


public class L_MyClass {
    private int m;
    L_MyClass() {
        m = 0;
    }
    L_MyClass(int m) {
        this.m = m;
    }



    public static void main(String[] args) {
        System.out.println("-----------带有一个参数的构造方法-----------");
        //调用带有一个参数的构造方法，Staff类中的sex和age属性值不变
        Worker worker1=new Worker("张强");
        System.out.println(worker1);
        System.out.println("-----------带有两个参数的构造方法------------");
        //调用带有两个参数的构造方法，Staff类中的sex属性值不变
        Worker worker2=new Worker("李丽",25);
        System.out.println(worker2);
    }
}
